package com.example.temp;

public class BinaryTreeNode {

    int value;
    BinaryTreeNode left;
    BinaryTreeNode right;

    public BinaryTreeNode(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }


    public static void main(String[] args) {

    }

    //前序遍历递归(recursion)
    public void preOrder(BinaryTreeNode node) {
        if (node == null) {
            return;
        } else {
            System.out.println(node.getValue());

            preOrder(node.left);
            preOrder(node.right);
        }
    }

    //    中序遍历递归
    public void midOrder(BinaryTreeNode node) {
        if (node ==null)
            return;
        System.out.println(node.left.getValue()+"");

        preOrder(node);
        preOrder(node.right);

    }
}
